package com.tanhua.admin.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tanhua.model.domain.Analysis;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;


public interface AnalysisMapper extends BaseMapper<Analysis> {

    /*累计用户数*/
    @Select("select sum(num_registered) from `tb_analysis_by_day`")
    Integer findCumulativeUsers();

    // 过去7、30天活跃
    //@Select("SELECT SUM(num_active) FROM `tb_analysis_by_day` WHERE record_Date BETWEEN DATE_FORMAT(#{startTime},'%Y-%m-%d') AND DATE_FORMAT(#{endTime},'%Y-%m-%d')")
   // Long  findActivePass(@Param("startTime") String startTime, @Param("endTime") String endTime);

    @Select("SELECT SUM(num_active) FROM `tb_analysis_by_day` WHERE record_Date BETWEEN (#{startTime}) AND(#{endTime})")
    Long  findActivePass(@Param("startTime") String startTime, @Param("endTime") String endTime);
    // 今日、昨天基础数据
    @Select("SELECT * FROM `tb_analysis_by_day` WHERE record_date = #{recordTime}")
    Analysis findBase(String recordTime);


}
